﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using System.Diagnostics;
using Stala;

namespace TestApp
{
	class InstallCommand : ICommand
	{
		IVersionInstaller installer;
		public IVersionInstaller Installer
		{
			get { return installer; }
			set
			{
				installer = value;
				CanExecuteChanged(this, null);
			}
		}

		public bool CanExecute(object parameter)
		{
			if (installer == null)
				return false;
			return true;
		}

		public event EventHandler CanExecuteChanged;

		public void Execute(object parameter)
		{
			installer.Install();

			App.Current.Shutdown();
		}
	}
}
